<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// This is a test for https://bugs.webkit.org/show_bug.cgi?id=9978
// REGRESSION (r12949-r12988): Clicking the first letter on a line places the
// caret at the end of the previous line.
selection_test(
    [
        '<div contenteditable id="test" style="font-size: 48; width: 250px;">',
            'Alice in Wonderland',
        '</div>',
    ],
    selection => {
        if (!window.eventSender)
            throw 'This test requires eventSender.';
        const target = selection.document.getElementById('test');
        const x = target.offsetLeft + 10;
        const y = target.offsetTop + target.offsetHeight - 10;
        eventSender.mouseMoveTo(x, y);
        eventSender.mouseDown();
        eventSender.mouseUp();
    },
    [
        '<div contenteditable id="test" style="font-size: 48; width: 250px;">',
            'Alice in |Wonderland',
        '</div>',
    ]);
</script>
